package client.view;

import client.Client;
import core.OrderedZone;

/**
 * A concrete View for an Zone that represents cards in an ordered, linear fashion.
 * Cards are drawn in the Zone in a queue, in the order in which they are added.
 */
public class OrderedZoneView extends ZoneView
{
	/**
	 * Creates a new OrderedZoneView visualization for the given OrderedZone.
	 */
	public OrderedZoneView(OrderedZone z, Client c) {
		super(z,c);
	}
	
	/**
	 * Removes all cards from the view of the Zone and adds them back.
	 * This is an admittedly naive way of refreshing the view of the Zone.
	 */
	public void updateView() {
		int increment = cardViews.isEmpty() ? 3 : 150 / cardViews.size(), lastCardPos = 10 - increment;
		for (CardView cardView : cardViews)
			cardView.getComponent().setLocation(lastCardPos += increment, 10);
	}
}
